import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/app/tools/locale_tool.dart';
import 'package:share_fit/generated/locales.g.dart';

class ExitDialog extends Dialog {
  Function callback;

  ExitDialog({required this.callback});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        child: Material(
            type: MaterialType.transparency,
            child: Center(
                child: GestureDetector(
                    onTap: () {
                      print('～');
                    },
                    child: Container(
                      width: 916.w,
                      height: LocaleTool.locale.contains('en')? 970.w:750.w,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: Colors.white,
                      ),
                      child: Column(
                        children: [
                          Container(
                            margin: EdgeInsets.fromLTRB(42.w, 80.h, 42.w, 0),
                            child: Text(LocaleKeys.exit_tips.ts, style: TextStyle(color: ColorConst.btnFontColor, fontSize: 54.sp),),
                          ),
                          Container(
                            margin: EdgeInsets.fromLTRB(42.w, 65.h, 42.w, 0),
                            child: Text(LocaleKeys.exit_tips_des.ts, style: TextStyle(color: ColorConst.btnFontColor, fontSize: 54.sp),),
                          ),
                          SizedBox(height: 113.h,),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceAround,
                            children: [
                              GestureDetector(
                                  behavior: HitTestBehavior.opaque,
                                  child: Container(
                                      width: 383.w,
                                      height: 136.h,
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(
                                        color: ColorConst.accentColor,
                                        borderRadius: BorderRadius.circular(10),
                                      ),
                                      child: Text(
                                          LocaleKeys.app_run_background.ts,
                                          textAlign: TextAlign.center,
                                          style: TextStyle(color: Colors.white, fontSize: LocaleTool.locale.contains('en')?46.sp:54.sp, fontWeight: FontWeight.w400)
                                      )
                                  ),
                                  onTap: () {
                                    callback(0);
                                    Navigator.pop(context);
                                  }),
                              GestureDetector(
                                  behavior: HitTestBehavior.opaque,
                                  child: Container(
                                      width: 383.w,
                                      height: 136.h,
                                      alignment: Alignment.center,
                                      decoration: BoxDecoration(
                                        color: ColorConst.secondaryBgColor,
                                        borderRadius: BorderRadius.circular(10),
                                      ),
                                      child: Text(
                                          LocaleKeys.exit_app.ts,
                                          textAlign: TextAlign.center,
                                          style: TextStyle(color: ColorConst.btnFontColor, fontSize: 42.sp, fontWeight: FontWeight.w400)
                                      )
                                  ),
                                  onTap: () {
                                    callback(1);
                                    Navigator.pop(context);
                                  })
                            ],)
                        ],),)
                ))),
        onTap: () {
          Navigator.pop(context);
        }
    );
  }
}